import {defineStore} from "pinia";

import {reqCategoryList} from "@/api";
import {Category} from "@/types";

const useCategoryStore = defineStore('category', {
    state : () => {
        return {
            categoryList : new Array<Category>(),
        }
    },

    getters: {
    },

    actions: {
        async loadList() {
            this.categoryList = ((await reqCategoryList()).data as Category[]).splice(0, 15)
        }
    },
})

export default useCategoryStore